<template>
    <div class="activity-promotion">
        <search-form :searchArray="searchArray">
            <el-button class="btn search mL20" >新增</el-button>
        </search-form>
        <elTable :formData="formData" @tableData="getList" ref="dataInfo">
                <el-table-column prop="name" label="图片" align="center"></el-table-column>
                <el-table-column prop="group" label="活动名称" align="center"></el-table-column>
                <el-table-column prop="createTime" label="时间" align="center"></el-table-column>
                <el-table-column prop="createTime" label="进行中的活动" align="center"></el-table-column>
                <el-table-column prop="createTime" label="添加人" align="center"></el-table-column>
                <el-table-column prop="createTime" label="审核结果" align="center"></el-table-column>
                <el-table-column prop="createTime" label="禁/启用" align="center"></el-table-column>
                
                <el-table-column prop="action" label="操作" align="center">
                    <template slot-scope="">
                        <el-button type="text">修改</el-button>
                        <el-button type="text">活动管理</el-button>
                        <el-button type="text">启用</el-button>
                    </template>
                </el-table-column>
        </elTable>
        <dialogs 
            :visible="showAdd"
            :title="!isEditer ? '新增' : '修改'"
        >
            <el-form v-model="form" label-width="120px">
                <el-form-item label="活动名称">
                    <el-input placeholder="请输入活动名称"></el-input>
                </el-form-item>
                <el-form-item label="活动类型">
                    <el-select v-model="form.type">
                        <el-option value=""></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="活动开始">
                    <el-date-picker
                        v-model="form.startTime"
                        type="datetime"
                        placeholder="选择日期时间">
                        </el-date-picker>
                </el-form-item>
                <el-form-item label="活动结束">
                    <el-date-picker
                        v-model="form.startTime"
                        type="datetime"
                        placeholder="选择日期时间">
                        </el-date-picker>
                </el-form-item>
                <el-form-item label="优惠券名称">
                    <el-input placeholder="请输入优惠券名称"></el-input>
                </el-form-item>
                <el-form-item label="优惠券类型">
                    <el-select v-model="form.type">
                        <el-option value=""></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="发行数量">
                    <el-input placeholder="请输入发行数量"></el-input>
                </el-form-item>
                <el-form-item label="满多少金额可用">
                    <el-input placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item label="满多少面额">
                    <el-input placeholder="请输入面额"></el-input>
                </el-form-item>
                <el-form-item label="总面值">
                    <el-input placeholder="请输入总面值"></el-input>
                </el-form-item>
                <el-form-item label="限领次数">
                    <el-input placeholder="请输入限领次数"></el-input>
                </el-form-item>
                <el-form-item label="限制发放开始时间">
                    <el-date-picker
                        v-model="form.startTime"
                        type="datetime"
                        placeholder="选择日期时间">
                        </el-date-picker>
                </el-form-item>
                <el-form-item label="限制发放结束时间">
                    <el-date-picker
                        v-model="form.startTime"
                        type="datetime"
                        placeholder="选择日期时间">
                        </el-date-picker>
                </el-form-item>
                <el-form-item label="是否允许与平台优惠券同时使用">
                    <el-select v-model="form.type">
                        <el-option value=""></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="是否允许与店铺红包同时使用">
                    <el-select v-model="form.type">
                        <el-option value=""></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="是否允许与店铺优惠券同时使用">
                    <el-select v-model="form.type">
                        <el-option value=""></el-option>
                    </el-select>
                </el-form-item>
            </el-form>
        </dialogs>
    </div>
</template>
<script>
import elTable from "@/components/xForm/elTable"
export default {
    name: 'activityPromotion',
    components: {
        elTable
    },
    data () {
        return {
            isEditer: false,
            form: {
                type: '',
                startTime: ''
            },
            showAdd: {
                show: true,
            },
            formData: {
                currentPage: 1,
                pageSize: 10,
            },
            searchArray: [
                {
                    type: 'input',
                    placeholder: '请输入活动名称',
                    value: '',
                    label: '活动名称'
                },
                {
                    type: "select",
                    placeholder: "请选择",
                    filterable: false,
                    value: "",
                    width: '',
                    label: '是否进行中',
                    list: [
                    {
                        label: "",
                        value: ""
                    }
                    ]
                },
                {
                    type: "select",
                    placeholder: "请选择",
                    filterable: false,
                    value: "",
                    width: '',
                    label: '启用/禁用',
                    list: [
                    ]
                },
            ],
        }
    },
    methods: {
        getList(pageNo) {
            let _this = this;
            _this.formData.currentPage = pageNo || _this.formData.currentPage;
            let dataInfo = [
                {
                    id: 1,
                    name: "你好",
                    createTime: '1595244696000'
                },
                {
                    id: 2,
                    name: "你好1",
                    createTime: '1595244696000'
                },
            ];
            let total = 10;
            this.$nextTick(() => {
                this.$refs.dataInfo.loadData(dataInfo, total);
            });
        },
    }
}
</script>
<style lang="scss" scoped>
.activity-promotion {
    .search-form {
        margin-bottom: 16px;
    }
}
</style>